import request from '../utils/request.js'
import store from '../store/index.js'

export function createJob(job) {
  return request({
    url: 'job/insert/',
    method: 'post',
    data: job
  })
}

export function getJobByJobId(jobId) {
  return request({
    url: 'job/id/' + jobId,
    method: 'get'
  })
}

export function getAllJob() {
  return request({
    url: 'job/all',
    method: 'get'
  })
}

export function getJobByJobPartId() {
  return request({
    url: 'job/part/' + store.getters.userPartId,
    method: 'get'
  })
}

export function updateJob(job) {
  return request({
    url: 'job/update',
    method: 'put',
    params: job
  })
}

export function updateJobStatus(jobId,jobStatus){
  return request({
    url: 'job/status/' + jobId + '/' +jobStatus ,
    method: 'put',
  })
} 

export function conditionSearchJob(condition) {
  return request({
    url: 'job/condition',
    method: 'get',
    params: condition
  })
}

export function deleteJob(jobId){
  return request({
    url: 'job/jobId/' + jobId,
    method: 'delete'
  })
}